load(
    "@io_bazel_rules_closure//closure:defs.bzl",
    "closure_js_binary",
    "closure_js_library",
    "closure_js_test",
)

closure_js_test(
    name = "client_test",
    size = "small",
    srcs = ["client_test.js"],
    entry_points = ["example.routeguide.closure.GrpcJsClientTest"],
    deps = [
        ":client",
        "//example/routeguide:routeguide_grpc_closure_js_library",
        "@com_google_javascript_closure_library//closure/goog/testing:asserts",
        "@com_google_javascript_closure_library//closure/goog/testing:jsunit",
        "@com_google_javascript_closure_library//closure/goog/testing:testsuite",
    ],
)

closure_js_library(
    name = "client",
    srcs = ["client.js"],
    deps = [
        "//example/routeguide:routeguide_grpc_closure_js_library",
        "@com_google_javascript_closure_library//closure/goog/promise",
    ],
)

closure_js_library(
    name = "main",
    srcs = ["main.js"],
    suppress = [
        "closureDepMethodUsageChecks",
        "useOfGoogProvide",
    ],
    deps = [":client"],
)

closure_js_binary(
    name = "bundle",
    compilation_level = "ADVANCED",
    debug = False,
    entry_points = ["goog:example.routeguide.closure.main"],
    output_wrapper = "(function(){%output%}).call(this);",
    suppress_on_all_sources_in_transitive_closure = [
        "JSC_MISSING_REQUIRE_TYPE_IN_PROVIDES_FILE",
        "JSC_MISSING_REQUIRE_IN_PROVIDES_FILE",
        "JSC_USE_OF_GOOG_PROVIDE",
        "JSC_DEPRECATED_PROP_REASON",
    ],
    deps = [":main"],
)
